<template>
  <a href="javascript:scroll(0,0,500)" 
    class="backTop"><img src="~assets/images/common/top.png" alt="" id="smallimg" v-show="isShow"></a>
</template>
<script> 
export default{
  name:"backTop",
  mounted(){
    window.addEventListener('scroll', this.handleScroll, true)
  },
  data(){
    return{
      isShow:false
    }
  },
  methods:{
    handleScroll(){
          // console.log(document.documentElement.scrollTop);
          this.isShow = (document.documentElement.scrollTop)>1000
        }
  }
}
</script>
<style scoped>
  .backTop{
  position: fixed;
  right: 8px;
  bottom: 50px;
}
.backTop #smallimg{
  width: 44px;
  height: 44px;
}
</style>